package com.buttonpay.balance;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.buttonpay.R;
import com.buttonpay.favourite.FavouriteTab;
import com.buttonpay.home.HomeScreen;

public class BalanceTab extends Activity 
{
    /** Called when the activity is first created. */

	Button btnLogout,btnBack;
	TextView tveaderText;
	
	@Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab);
        
        btnLogout=(Button)findViewById(R.id.btnLogout);
        btnBack=(Button)findViewById(R.id.btnPrevious);
        tveaderText=(TextView)findViewById(R.id.tv_headerText);
        
        tveaderText.setText("Balance");
        btnBack.setVisibility(Button.INVISIBLE);
        
        btnLogout.setOnClickListener(new OnClickListener()
        {
			
			public void onClick(View arg0) 
			{
				// TODO Auto-generated method stub
				  
				  new AlertDialog.Builder(BalanceTab.this)
			        .setTitle( "Exit Application" )
			        .setMessage( "Are you sure you want to Logout?" )
			        .setPositiveButton("YES", new android.content.DialogInterface.OnClickListener() 
			        {
			            public void onClick(DialogInterface arg0, int arg1) 
			            {
			                //do stuff onclick of YES
			            	setResult(2);
			            	finish();
			            }

						public void onClick(View v) 
						{
							// TODO Auto-generated method stub
							
						}
			        })
			        .setNegativeButton("NO",  new android.content.DialogInterface.OnClickListener() {
			            public void onClick(DialogInterface arg0, int arg1)
			            {
			                //do stuff onclick of CANCEL
			            	arg0.dismiss();
			               
			            }

						public void onClick(View v) 
						{
							// TODO Auto-generated method stub
						}
			        }).show();
			}
		});
        
        
    }
	@Override
	public void onBackPressed() 
	{
		// TODO Auto-generated method stub
		
		new AlertDialog.Builder(BalanceTab.this)
        .setTitle( "Exit Application." )
        .setMessage( "Are you sure you want to Exit ?" )
        .setPositiveButton("YES", new android.content.DialogInterface.OnClickListener() 
        {
            public void onClick(DialogInterface arg0, int arg1) 
            {
                //do stuff onclick of YES
            	finish();
            }

			public void onClick(View v) 
			{
				// TODO Auto-generated method stub
				
			}
        })
        .setNegativeButton("NO",  new android.content.DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1)
            {
                //do stuff onclick of CANCEL
            	arg0.dismiss();
               
            }

			public void onClick(View v) 
			{
				// TODO Auto-generated method stub
			}
        }).show();
	}
}